<template>
  <div>
    <span>活动车型</span>
    <div class="box_01">
      <FilterTable
        ref="table"
        :columns="columns"
        :dataSource="list1"
        :isColumnFilter="false"
        :isToperInfo="false"
        :isSelectColumn="false"
        :onSyncTableData="syncTableFun"
        :onColumnsChange="columns => (this.columns = columns)"
      >
        <!-- <template slot="controls" slot-scope="props">
           <el-button
             size="small"
             type="primary"
             icon="el-icon-plus"
             @click="addActscopeHandle()"
           >新增</el-button>
         </template> -->
      </FilterTable>
    </div>
    <!-- <span :style="{display : 'block',paddingTop: '5px'}">活动车辆</span> -->
    <!-- <div class="box_02">
             <FilterTable
        ref="table"
        :columns="columns2"
        :dataSource="list2"
        :isColumnFilter = false
        :isToperInfo    = false
        :isSelectColumn = false
        :onColumnsChange="columns => this.columns2 = columns"
      >
         <template slot="controls" slot-scope="props">
           <el-button
             size="small"
             type="primary"
             icon="el-icon-upload2"
             @click="importHandle()"
           >导入</el-button>
            <el-button
             size="small"
             type="primary"
             icon="el-icon-download"
           >导出</el-button>
            <el-button
             size="small"
             type="primary"
             icon="el-icon-download"
           >模板下载</el-button>
         </template>
      </FilterTable>
      </div> -->
    <!-- <BaseDialog
      :visible.sync="visibleAddactscope"
      title="选择车型"
      :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}"
      destroyOnClose>
      <AddActcsope  ref="asddActcsope" @closeaddAct="closeAddactcsope" />
    </BaseDialog> -->
    <!-- <BaseDialog
      :visible.sync="visiblefwhddr"
      title="服务活动导入"
      :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '30px'}"
      destroyOnClose>
      <fwhddr  ref="fwhddr" @closeFwhddr="closeAddfwhddr" />
    </BaseDialog> -->
  </div>
</template>
<script>
//  import fwhddr  from './AddActcsope/fwhddr'
//  import AddActcsope from './AddActcsope/addActcsope'
import { dictionary } from '@/utils/dictMixin';
import { detailsActscope } from '@/api/repair/repair/activitesManage';
// import { getFwhdHdclList , getFwhdHdcxList} from '@/api/repair/repairReception/customer/activity.js';
let _this;
export default {
  name: 'Actcsope',
  components: {
    // AddActcsope,
    // fwhddr
  },
  mixins: [dictionary],
  props: ['detaildata'],
  data() {
    // this.BaseTable = null;
    return {
      visiblefwhddr: false,
      visibleAddactscope: false,
      columns: this.createTableColumns(),
      columns2: this.createTableColumns2(),
      list1: [],
      list2: [],
      tableData: []
    };
  },
  created() {
    _this = this;
    console.log(_this.detaildata, '_this_this_this_this_this_this');
    _this.detailsActscope();
  },
  mounted() {},
  methods: {
    // 获取活动车型方法
    async detailsActscope() {
      let res = await detailsActscope(this.detaildata);
      console.log(res.data.rows, 'res.data.rows');
      _this.$refs.table.$refs.pageTable.EXECUTE_INSERT(res.data.rows);
    },
    // importHandle () {
    //   this.visiblefwhddr = true
    // },
    // 传给父组件的数据
    syncTableFun(val) {
      this.tableData = val;
    },
    // closeAddfwhddr (val) {
    //   console.log(val,'val')
    //   this.visiblefwhddr = false
    // },
    // addActscopeHandle () {
    //   this.visibleAddactscope = true
    // },
    ceshi(val) {
      // console.log(_this.list1,'Actcsope')
      _this.$emit('changeEmptyone', _this.list1);
    },
    // closeAddactcsope (val) {
    //   this.visibleAddactscope = false
    //     if (val != false){
    //       this.$refs.table.$refs.pageTable.EXECUTE_INSERT(val)
    //     }
    // },
    // 活动车型表单数据删除
    delete(val) {
      console.log(val);
      let a = [];
      a.push(val);
      this.$refs.table.$refs.pageTable.EXECUTE_DELETE(a);
    },
    createTableColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 70,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        // {
        //     title: '操作',
        //     dataIndex: '',
        //     // sorter: true,
        //     //  render: props => {
        //     //   return  <el-button size="mini" type="text" onClick={()=>this.delete(props.row)}>
        //     //      删除
        //     //   </el-button>;
        //     // }
        // },
        {
          title: '活动编号',
          dataIndex: 'ACTIVITY_CODE',
          sorter: true
        },
        {
          title: '品牌',
          dataIndex: 'BRAND_NAME1',
          sorter: true
        },
        {
          title: '车系',
          dataIndex: 'SERIES_NAME',
          sorter: true
        },
        {
          title: '车型',
          dataIndex: 'MODEL_NAME1',
          sorter: true
        }
      ];
    },
    createTableColumns2() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 70
          // render: props => {
          //   return <span>{props.row.index + 1}</span>;
          // }
        },
        // {
        //     title: '操作',
        //     dataIndex: '',
        // },
        {
          title: '活动编号',
          dataIndex: 'ACTIVITY_CODE',
          sorter: true
        },
        {
          title: '责任维修站',
          dataIndex: 'DUTY_ENTITY',
          sorter: true
        },
        {
          title: 'VIN',
          dataIndex: 'VIN',
          sorter: true
        }
      ];
    },
    async getFwhdHdclList(row) {
      const res = await getFwhdHdclList(row, {
        creditTimes: 1.0,
        afterlabour: 0,
        zkAmountLabour: 0,
        afterDiscountAmountPart: 0,
        zkAmountPart: 0,
        fag: 'U',
        labourList: '',
        partList: '',
        subjoinList: '',
        modelList: '',
        vehicleList: '',
        order: 'asc',
        limit: 10,
        offset: 0,
        dmsFuncId: 35100010,
        _: 1565681747515
      });
      this.list2 = res.rows;
      console.log('活动车辆table', res);
    },
    async getFwhdHdcxList(row) {
      const res = await getFwhdHdcxList(row, {
        creditTimes: 1.0,
        afterlabour: 0,
        zkAmountLabour: 0,
        afterDiscountAmountPart: 0,
        zkAmountPart: 0,
        fag: 'U',
        labourList: '',
        partList: '',
        subjoinList: '',
        modelList: '',
        vehicleList: '',
        order: 'asc',
        limit: 10,
        offset: 0,
        dmsFuncId: 35100010,
        _: 1565681747515
      });
      this.list1 = res.rows;
      console.log('活动车型table', res);
    }
  }
};
</script>

<style lang="less" scoped>
.box_01 {
  margin-top: 10px;
}
.box_02 {
  margin-top: 10px;
}
</style>
